package Error;

import interfaces.ErrorReport;
import interfaces.Pointer;
import Language.Language;

public class PointerError implements ErrorReport {
	private Pointer pointer;
	private String message;
	private ErrorType type;
	
	public PointerError(Pointer pointer, String message, ErrorType type) {
		if (pointer == null) {
			message = Language.noPointer;
			
		} else if (message.equals(null)) {
			message = Language.noMessage;
		}
		
		this.pointer = pointer;
		this.message = message;
		this.type = type;
	}
	
	@Override
	public String getErrorMessage() {
		if (pointer == null) {
			return message;
		} else {
			return "Error in pointer #" + pointer.getPosition() + ", " + message;
		}
	}

	@Override
	public ErrorType getType() {
		return ErrorType.ERROR;
	}

}
